﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title>用户绑定</title>
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type="text/javascript" src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.css" />
    <script type="text/javascript">
        function getQueryString(name) {
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        }
        $(function () {
            var openid = $("#openid");
            var account = $("#Account");
            var password = $("#Password");
            var stropenid = getQueryString('openid');
            openid.val(stropenid);
            var d = new Date();

            $.get('../Register.ashx?flag=check&&openid=' + stropenid + "&&random=" + d.getTime(), function (data) {
                if (data == null || data == "") {
                    $("#status").html("未绑定账号,请提交绑定账号！");
                }
                else {
                    $("#status").html("已绑定账号：" + data + "&nbsp;&nbsp;可重新提交绑定新账号！");
                }
            });
            $("#Submit").bind('click', function () {
                $.get('../Register.ashx?flag=reg&&openid=' + openid.val() + "&&account=" + account.val() + "&&password=" + password.val() + "&&random=" + d.getTime(), function (data) {
                    $(".col-md-12").eq(0).empty().html("<h3 style='font-weight:bold; color:Red;'>" + data + "</h3>");
                });
            });
        });
    </script>
</head>
<body>
    <div class="navbar">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="#"><span>平台账号绑定</span></a>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="col-md-12">
            <form class="form-horizontal" role="form">

                <div class="form-group">
                    <label for="Account" class="col-md-2 control-label">
                        当前状态
                    </label>
                    <div class="col-md-10">
                        <span id="status" style=" font-weight:bold; color:Red;"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="openid" class="col-md-2 control-label">
                        微信标识
                    </label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="openid" disabled />
                    </div>
                </div>
                <div class="form-group">
                    <label for="Account" class="col-md-2 control-label">
                        平台账号
                    </label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" id="Account" placeholder="平台账号" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="Password" class="col-md-2 control-label">
                        平台密码
                    </label>
                    <div class="col-md-10">
                        <input type="Password" class="form-control" id="Password" placeholder="平台密码" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-xs-12 col-lg-push-2 col-lg-10 col-sm-12 col-md-10 col-md-push-2">
                        <button id="Submit" type="button" class="btn btn-info btn-block" style=" background-color:Green;">
                            <span class="glyphicon glyphicon-ok" style="cursor: pointer"></span>绑定账号
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
</html>
